package com.service.device;

import com.dao.secondary.device.DevicePcbGpsInfoMapper;
import com.github.pagehelper.PageHelper;
import com.model.domain.device.GetDevicePcbGpsInfoDO;
import com.model.pojo.device.DevicePcbGpsInfo;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;


/**
 * @Author: zql
 * @Description: PCB定位信息服务
 * @Data: 2023-04-16
 */
@Slf4j
@Service
@RequiredArgsConstructor
public class DevicePcbGpsInfoService {
    private final DevicePcbGpsInfoMapper devicePcbGpsInfoMapper;

    /**
     * 获取分页列表信息
     * @author tm
     * @date 2023-04-16 9:03
     * @param
     * @param getDevicePcbGpsInfoDO
     * @return List<DevicePcbGpsInfo>
     */
//    public List<DevicePcbGpsInfo> getPageList(String tableName, String startTime, String endTime, String dtu){
//        PageHelper.clearPage();
//        return devicePcbGpsInfoMapper.selectList(tableName,startTime,endTime,dtu);
//    }

    public List<DevicePcbGpsInfo> getPageList(GetDevicePcbGpsInfoDO getDevicePcbGpsInfoDO){
        PageHelper.clearPage();
        PageHelper.startPage(getDevicePcbGpsInfoDO.getPage(), getDevicePcbGpsInfoDO.getPageSize(), getDevicePcbGpsInfoDO.getSortRow() + getDevicePcbGpsInfoDO.getSortOrder());
        return devicePcbGpsInfoMapper.selectList(getDevicePcbGpsInfoDO);
    }

    public List<DevicePcbGpsInfo> getAllList(GetDevicePcbGpsInfoDO getDevicePcbGpsInfoDO){
        PageHelper.clearPage();
        PageHelper.orderBy( getDevicePcbGpsInfoDO.getSortRow() + getDevicePcbGpsInfoDO.getSortOrder());
        return devicePcbGpsInfoMapper.selectList(getDevicePcbGpsInfoDO);
    }

    public List<Map<String,Object>> getListGroupBy(GetDevicePcbGpsInfoDO getDevicePcbGpsInfoDO){
        return devicePcbGpsInfoMapper.selectListGroupBy(getDevicePcbGpsInfoDO);
    }

    public DevicePcbGpsInfo getById(String tableName,Long id){
        return devicePcbGpsInfoMapper.selectByPrimaryKey(tableName,id);
    }
}
